﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Pages/Site1.Master" AutoEventWireup="true" CodeBehind="Cost_Register.aspx.cs" Inherits="ES_Project.Pages.WebForm2" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
<link type="text/css" href="js/js/css/ui-lightness/jquery-ui-1.8.10.custom.css" rel="stylesheet" />	
<link type="text/css" href="js/js/css/jquery.timeentry.css" rel="stylesheet" />
  <script type="text/javascript" src="js/js/jquery-1.4.4.min.js"></script>
  <script type="text/javascript" src="js/js/jquery-ui-1.8.10.offset.datepicker.min.js"></script>
  <script type="text/javascript" src="js/js/jquery.datepick-th.js"></script>
  <script type="text/javascript" src="js/js/jquery-ui-timepicker-addon.js"></script>
  <script type="text/javascript" src="js/js/jquery.timeentry.js"></script>
  <script type="text/javascript" src="js/js/jquery.timeentry.min.js"></script>
  <script type="text/javascript" src="js/js/jquery.timeentry.pack.js"></script>
    <style type="text/css">
table{font-size:inherit;margin-top: 0px;
    color: #000000;
}
TABLE {
	MARGIN-BOTTOM: 0px
}
        .style4
        {
            width: 1167px;
        }
    .DNNAlignright {
	TEXT-ALIGN: right
}
select,input,button,textarea,button{font:99% arial,helvetica,clean,sans-serif;}
INPUT {
	FONT: 700 small normal normal arial, helvetica, clean, sans-serif; COLOR: #057cc4; MARGIN-LEFT: 0px; MARGIN-RIGHT: 0px;
    text-align: left;
            margin-top: 0px;
        }
SELECT {
	FONT: 700 small normal normal arial, helvetica, clean, sans-serif; COLOR: #057cc4; MARGIN-LEFT: 0px; MARGIN-RIGHT: 0px
}
TEXTAREA {
	FONT: 700 small normal normal arial, helvetica, clean, sans-serif; COLOR: #057cc4; MARGIN-LEFT: 0px; MARGIN-RIGHT: 0px
}
TH {
	FONT-FAMILY: Tahoma, Arial, Helvetica; COLOR: #003366; FONT-SIZE: 12px; VERTICAL-ALIGN: baseline; FONT-WEIGHT: bold
}
        .style15
        {
            width: 100%;
        }
        .style19
        {
            width: 47px;
        }
        .style20
        {
            width: 1167px;
            font-size: small;
        }
        .style24
        {
            font-size: small;
            font-weight: bold;
            text-align: right;
            width: 95px;
        }
        .style27
        {
            width: 207px;
        }
        .style31
        {
            font-size: small;
            text-align: right;
            width: 141px;
        }
        .style32
        {
            width: 277px;
        }
        .style33
        {
            font-size: small;
        }
        .style34
        {
            width: 12px;
        }
        .style35
        {
            font-size: small;
            text-align: right;
            width: 220px;
        }
        .style36
        {
            width: 12px;
            height: 45px;
        }
        .style37
        {
            width: 1167px;
            height: 45px;
        }
        .style38
        {
            width: 47px;
            height: 45px;
        }
        .style39
        {
            color: #FF0000;
        }
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
 

        <asp:ScriptManager ID="ScriptManager1" runat="server" />
        <script type="text/javascript">

            $(Sys.Application.add_load(function () {

                // alert();
                $("#ContentPlaceHolder1_clsRegCode").focusout(function () {
                    //  alert("fdfdf");
                    document.getElementById('ContentPlaceHolder1_CMD_ClsRegCode').click();
                })
                //$('#ContentPlaceHolder1_empClsStart').timepicker({});
            }));
    </script>
    <script type ="text/javascript">
        function gotoButton(e) {
            var keyPressed;
            if (window.event) {
                keyPressed = window.event.keyCode; // IE
                if (keyPressed == 13) {


                    //  document.getElementById("CMD_AgentCode").focus();
                    document.getElementById('ContentPlaceHolder1_CMD_ClsRegCode').click();
                }

            } else {
                keyPressed = e.which; // Firefox
                if (keyPressed == 13) {
                    document.getElementById('ContentPlaceHolder1_CMD_ClsRegCode').click();
                    //document.getElementById("CMD_AgentCode").focus();
                }

            }
        }

        function chButton() {

            if (document.getElementById("ContentPlaceHolder1_clsRegCode").value == "") {
                alert("กรุณาระบุรหัสครูเพื่อค้นหาครูผู้สอน");
                //document.getElementById("AgentCode").focus();
                return (false);
            }
            if (document.getElementById("ContentPlaceHolder1_clsRegCode").value.length != 2) {
                //alert("กรุณาระบุรหัสตัวแทนให้ครบ 6 หลัก");
                document.getElementById("ContentPlaceHolder1_clsRegId").focus();
                return (false);
            }



            return true;

        }
        function validate() {

            if (document.getElementById("ContentPlaceHolder1_clsRegCode").value == "") {
                alert("กรุณาระบุรหัสวิชา");
                //document.getElementById("AgentCode").focus();
                return (false);
            }
            if (document.getElementById("ContentPlaceHolder1_clsCourseTime").value == "") {
                alert("กรุณาระบุจำนวนคอร์ส");
                // document.getElementById("ContentPlaceHolder1_clsRegId").focus();
                return (false);
            }
            if (document.getElementById("ContentPlaceHolder1_clsCourseAmt").value == "") {
                alert("กรุณาระบุค่าเรียน");
                // document.getElementById("ContentPlaceHolder1_clsRegId").focus();
                return (false);
            }



            return true;

        }
        
    </script> 
    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
        <ContentTemplate>
            <table cellpadding="0" cellspacing="0" class="style2">
                <tr>
                    <td class="style36">
                        </td>
                    <td class="style37">
                        <strong>บันทึกอัตราค่าลงทะเบียน</strong></td>
                    <td class="style38">
                        </td>
                </tr>
                <tr>
                    <td class="style34">
                        &nbsp;</td>
                    <td class="style4">
                        &nbsp;</td>
                    <td class="style19">
                        &nbsp;</td>
                </tr>
                <tr>
                    <td class="style34">
                        &nbsp;</td>
                    <td class="style4">
                        <table cellpadding="0" cellspacing="0" class="style15">
                            <tr>
                                <td class="style35">
                                    <strong>รหัสวิชา :</strong></td>
                                <td class="style32">
                                    <asp:TextBox ID="clsRegDetailId" runat="server" style="display:none"></asp:TextBox>
                                    <asp:TextBox ID="clsRegCode" runat="server" onkeydown="gotoButton(event)"   onkeypress ="gotoButton(event)"></asp:TextBox>
                                    <span class="style39">*</span>
                                    <asp:Button ID="CMD_ClsRegCode" runat="server" onclick="CMD_ClsRegCode_Click" OnClientClick="return chButton()" 
                                      Text="ค้นหา" CssClass="stylebutton" style="display:none"/>
                                    </td>
                                    <asp:Label ID="clsRegId" runat="server"  style="display:none"></asp:Label>
                                <td class="style31">
                                    <strong>วิชา :</strong></td>
                                <td class="style27">
                                    <asp:TextBox ID="clsName" runat="server" Width="143px" style="background-color: #CCCCCC" ReadOnly="True"></asp:TextBox>
                                    </td>
                                <td class="style24">
                                    &nbsp;</td>
                                <td>
                                    &nbsp;</td>
                            </tr>
                            <tr>
                                <td class="style35">
                                    &nbsp;</td>
                                <td class="style32">
                                    &nbsp;</td>
                                <td class="style31">
                                    &nbsp;</td>
                                <td class="style27">
                                    &nbsp;</td>
                                <td class="style24">
                                    &nbsp;</td>
                                <td>
                                    &nbsp;</td>
                            </tr>
                            <tr>
                                <td class="style35">
                                    <b>คอร์ส :</b></td>
                                <td class="style32">
                                    <asp:TextBox ID="clsCourseTime" runat="server"></asp:TextBox>
                                    <span class="style39">*</span>
                                    &nbsp;<strong><span class="style33">คาบ&nbsp;&nbsp;&nbsp; </span>
                                    <asp:TextBox ID="clsCourseNo" runat="server" Height="16px" Width="51px" style="background-color: #CCCCCC;display:none" ReadOnly="True"  ></asp:TextBox>
                                    </strong></td>

                                <td class="style31">
                                    <strong>ค่าเรียน :</strong></td>
                                <td class="style27">
                                    <asp:TextBox ID="clsCourseAmt" runat="server" Width="141px"></asp:TextBox>
                                    <span class="style39">*</span>
                                    &nbsp;<strong><span class="style33">บาท</span></strong></td>
                                <td class="style24">
                                    &nbsp;</td>
                                <td>
                                    &nbsp;</td>
                            </tr>
                            <tr>
                                <td class="style35">
                                    &nbsp;</td>
                                <td class="style32">
                                    &nbsp;</td>
                                <td class="style31">
                                    &nbsp;</td>
                                <td class="style27">
                                    &nbsp;</td>
                                <td class="style24">
                                    &nbsp;</td>
                                <td>
                                    &nbsp;</td>
                            </tr>
                            <tr>
                                <td class="style35">
                                    &nbsp;</td>
                                <td class="style32">
                                    &nbsp;</td>
                                <td class="style31">
                                    &nbsp;</td>
                                <td class="style27">
                                    &nbsp;</td>
                                <td class="style24">
                                    &nbsp;</td>
                                <td>
                                    &nbsp;</td>
                            </tr>
                            <tr>
                                <td class="style35">
                                    &nbsp;</td>
                                <td class="style32">
                                    <asp:Button ID="CMD_INSERT" runat="server" Text="  บันทึก  " OnClick="CMD_INSERT_Click"
                                        Width="56px" OnClientClick = "return validate()"/>
                                    &nbsp;<asp:Button ID="CMD_EDIT" runat="server" Text="แก้ไข" OnClick="CMD_INSERT_Click"/>
                                    &nbsp;<asp:Button ID="CMD_CLEAR" runat="server" Text="เคลียร์" OnClick = "CMD_CLEAR_Click"/>
                                </td>
                                <td class="style31">
                                    &nbsp;</td>
                                <td class="style27">
                                    &nbsp;</td>
                                <td class="style24">
                                    &nbsp;</td>
                                <td>
                                    &nbsp;</td>
                            </tr>
                        </table>
                    </td>
                    <td class="style19">
                        &nbsp;</td>
                </tr>
                <tr>
                    <td class="style34">
                    </td>
                    <td class="style4">
                        &nbsp;</td>
                    <td class="style19">
                        &nbsp;</td>
                </tr>
                <tr>
                    <td class="style34">
                        &nbsp;</td>
                    <td class="style20">
                        &nbsp;</td>
                    <td class="style19">
                        &nbsp;</td>
                </tr>
                <tr>
                    <td class="style34">
                        &nbsp;</td>
                    <td class="style4">
                        <asp:GridView ID="GridView4" runat="server" AutoGenerateColumns="False" 
                         DataKeyNames="cls_reg_detail_id"  Width="100%" OnSelectedIndexChanging = "GridView4_SelectedIndexChanging"
                         OnRowDeleting = "GridView4_RowDeleting" 
                            onrowdatabound="GridView4_RowDataBound"  >
                        <AlternatingRowStyle BackColor="PaleGoldenrod" />
                            <Columns>
                                <asp:TemplateField HeaderText="ลำดับ">
                                    <HeaderTemplate>
                                        ลำดับ
                                    </HeaderTemplate>
                                    <ItemTemplate>
                                       <%#Container.DataItemIndex+1 %>
                                    </ItemTemplate>
                                <ItemStyle HorizontalAlign="Center" />
                                </asp:TemplateField>
                                <asp:TemplateField Visible="false">
                                    <ItemTemplate>
                                       <asp:HiddenField ID="HiddenField3" runat="server" Visible="false"
                                          Value='<%# Eval("cls_reg_detail_id") %>' />
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:BoundField DataField="cls_reg_code" HeaderText="รหัสวิชา"
                                    ItemStyle-HorizontalAlign="left">
                                    <ItemStyle HorizontalAlign="Left" /> 
                                </asp:BoundField >
                                <asp:BoundField DataField="cls_name" HeaderText="ชื่อวิชา"
                                    ItemStyle-HorizontalAlign="left">
                                    <ItemStyle HorizontalAlign="Left" /> 
                                </asp:BoundField >
                                <asp:BoundField DataField="cls_course_time" HeaderText="คอร์ส(คาบ)"
                                    ItemStyle-HorizontalAlign="left">
                                    <ItemStyle HorizontalAlign="Left" /> 
                                </asp:BoundField >
                                <asp:BoundField DataField="cls_course_amt" HeaderText="ค่าเรียน"
                                    ItemStyle-HorizontalAlign="left">
                                    <ItemStyle HorizontalAlign="Left" /> 
                                </asp:BoundField >
                                 <asp:CommandField ButtonType="Image" HeaderText="แก้ไข" 
                                    ItemStyle-HorizontalAlign="Center" 
                                    SelectImageUrl="~/Pages/images/icon_15.gif" ShowSelectButton="True" >
                                    <ItemStyle HorizontalAlign="Center" />
                                </asp:CommandField>
                                <asp:CommandField ButtonType="Image" HeaderText="ลบ" 
                                              ItemStyle-HorizontalAlign="Center" 
                                              SelectImageUrl="~/Pages/images/icon_del.gif"  
                                    ShowDeleteButton="True" DeleteImageUrl="~/Pages/images/icon_del.gif" 
                                    DeleteText="" >
                                              <ItemStyle HorizontalAlign="Center" />
                                </asp:CommandField>
                                 <%--<asp:TemplateField HeaderText="ลบ" ItemStyle-HorizontalAlign="Center" 
                                              ShowHeader="False">
                                   <ItemTemplate>
                                        <asp:ImageButton ID="ImageButton1" runat="server" CausesValidation="False" 
                                        CommandName="Delete" ImageUrl="~/Pages/images/icon_del.gif" 
                                        Text="Delete" />
                                    </ItemTemplate>
                                    <ItemStyle HorizontalAlign="Center" />
                                </asp:TemplateField>--%>
                            </Columns>
                            <EditRowStyle BackColor="#2461BF" />
                            <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                            <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                            <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
                            <RowStyle BackColor="#EFF3FB" />
                            <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
                            <SortedAscendingCellStyle BackColor="#F5F7FB" />
                            <SortedAscendingHeaderStyle BackColor="#6D95E1" />
                            <SortedDescendingCellStyle BackColor="#E9EBEF" />
                            <SortedDescendingHeaderStyle BackColor="#4870BE" />
                        </asp:GridView>
                        <%--<asp:EntityDataSource ID="EntityDataSource1" runat="server" 
                        ConnectionString="name=essystemEntities"   
                        DefaultContainerName="essystemEntities" EnableDelete="True" 
                       AutoGenerateWhereClause="true" EnableInsert="True" EnableUpdate="True"   
                         EntitySetName="cls_register_detail"    > 
                        </asp:EntityDataSource>--%>
                    </td>
                    <td class="style19">
                        &nbsp;</td>
                </tr>
                <tr>
                    <td class="style34">
                        &nbsp;</td>
                    <td class="style4">
                        &nbsp;</td>
                    <td class="style19">
                        &nbsp;</td>
                </tr>
                <tr>
                    <td class="style34">
                        &nbsp;</td>
                    <td class="style20">
                        &nbsp;</td>
                    <td class="style19">
                        &nbsp;</td>
                </tr>
                <tr>
                    <td class="style34">
                        &nbsp;</td>
                    <td class="style4">
                        &nbsp;</td>
                    <td class="style19">
                        &nbsp;</td>
                </tr>
                <tr>
                    <td class="style34">
                        &nbsp;</td>
                    <td class="style4">
                        &nbsp;</td>
                    <td class="style19">
                        &nbsp;</td>
                </tr>
            </table>
        </ContentTemplate>
    </asp:UpdatePanel>
     <br />
 
</asp:Content>